package org.lds.message.center.plugin.core.kafka;

import org.lds.message.center.common.AbstractMessageService;
import org.lds.message.center.common.model.request.CommonRequest;

import java.util.List;

public abstract class MessageServiceKafkaConsumer<T extends CommonRequest> extends AbstractKafkaConsumer<T> {
    private final AbstractMessageService messageService;

    public MessageServiceKafkaConsumer(AbstractMessageService messageService, Class<T> clazz) {
        super(clazz);
        this.messageService = messageService;
    }

    @Override
    protected void doConsume(List<T> requests) {
        requests.forEach(request -> messageService.handle(request));
    }

}
